/**
 * 商家端移入app端API
 */
import {
	http,
	Method
} from "@/utils/request.js";
import api from "@/config/api.js";

/**
 * 获取叫车信息
 * @param tradeSn 交易编号
 */
export function getCarInfo(tradeSn = "") {
	return http.request({
		url: `${api.buySeller}/order/order/getCarInfo/${tradeSn}`,
		method: Method.GET,
		needToken: true,
	});
}

/**
 * 添加-修改叫车信息
 * @param tradeSn 交易编号
 * @param params 车辆信息
 */
export function updateCarInfo(tradeSn = "", params) {
	return http.request({
		url: `${api.buySeller}/order/order/update/${tradeSn}/call`,
		method: Method.POST,
		needToken: true,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		},
		data: params
	});
}

/**
 * 订单明细
 * @param orderSn 订单编号
 */
export function getOrderInfo(orderSn = "") {
	return http.request({
		url: `${api.buySeller}/order/order/${orderSn}`,
		method: Method.GET,
		needToken: true,
	});
}

/**
 * 添加-修改叫车信息
 * @param tradeSn 交易编号
 * @param params
 */
export function noNeedCar(tradeSn = "") {
	return http.request({
		url: `${api.buySeller}/order/order/update/${tradeSn}/notNeedCall`,
		method: Method.POST,
		needToken: true,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		},
	});
}